<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue-2.6.12.js"></script>
</head>
<body>
  <div id="app">
    <button-counter></button-counter>
    <button-counter></button-counter>
  </div>
  <script>
    
    Vue.component("button-counter",{
      template:"<div><button @click='increment'>你点了我{{count}}次，我记住了</button><input type='text'/></div>",
      data:function(){
        return {
          count:0
        }
      },
      methods:{
        increment:function(){
          this.count++;
        }
      }
    });
    new Vue({
      el:"#app",
      data:{
        hello:"zhangsan"
      }
    });
  </script>
</body>
</html>